<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%String path = request.getContextPath();%>
<script type="text/javascript" src="<%=path%>/projectjs/cardEntity.js"></script>
<script type="text/javascript">
function changeDeferType(type){
	if (type==0) {
		$("#p_date").css("display", "none");
		$("#p_month").css("display", "block");
	}
	else {
		$("#p_month").css("display", "none");
		$("#p_date").css("display", "block");
	}
}
function subDeferMemberCardForm(obj){
	if($("input[name='deferType']:checked").val()==1){
		if($("#defer_inp_dateTo").val()==""){
			alertMsg.error("请选择需要延期的日期！");
			return false;
		}
		if(!checkCurrentDate("defer_inp_dateTo"))return false;
		if (!checkDate("defer_inp_dateFrom","defer_inp_dateTo"))return false;
	}
	return iframeCallback(obj, processHandleResult);
}
function processHandleResult(json){
	parent.reloadPage();
	$.pdialog.closeCurrent();
}
</script>
<div class="pageContent">
	<form action="<%=path%>/memberCard/deferMemberCard.action" method="post" class="pageForm" onsubmit="return subDeferMemberCardForm(this);">
	<input type="hidden" name="memberCardVO.id" value="${param.id}">
	<input type="hidden" name="memberCardVO.expiryDateTo" value="${param.expiryDateTo}">
	<input type="hidden" id="defer_inp_dateFrom" name="memberCardVO.expiryDateFrom" value="${param.expiryDateFrom}">
	<div class="pageFormContent" layoutH="56">
		<p style="width:100%;float: none;text-align: center"></p>
		<p style="width:100%;float: none;text-align: center">
			会员卡有效期从 <b id="b_dateFrom">${param.expiryDateFrom}</b> 到 <b>${param.expiryDateTo}</b>
		</p>
		<div class="divider"></div>
		<p style="width:100%;float: none;text-align: center">
			<input type="radio" name="deferType" value="0" checked="checked" onclick="changeDeferType(this.value);"/>按月延期
			<input type="radio" name="deferType" value="1" onclick="changeDeferType(this.value);"/>按日期延期
		</p>
		<p style="width:100%;float: none;text-align: center; display: none" id="p_date">
			<input id="defer_inp_dateTo" type="text" name="deferDate" class="date" dateFmt="yyyy-MM-dd" readonly="true" value="${param.expiryDateTo}" style="float: none"/>
		</p>
		<div class="divider" style="border: 0"></div>
		<p style="width:100%;float: none;text-align: center" id="p_month">
			<label style="width: 220px">&nbsp;</label>
			<select name="deferMonth" class="combox" style="float: none">
				<c:forTokens items="1,2,3,4,5,6,7,8,9,10,11,12" delims="," var="month">
					<option value="${month}">延期${month}个月</option>
				</c:forTokens>
			</select>
		</p>
	</div>
	<div class="formBar">
		<ul>
			<li><div class="buttonActive"><div class="buttonContent"><button id="upload_file_button" type="submit">保存</button></div></div></li>
			<li><div class="button"><div class="buttonContent"><button class="close" type="button">取消</button></div></div></li>
		</ul>
	</div>
	</form>
<script type="text/javascript">
if("${param.expiryDateFrom}"==""){
	var curDate = getToday();
	$("#b_dateFrom").text(curDate);
	$("#defer_inp_dateFrom").val(curDate);
}
</script>
</div>